package org.dt.common.sequence.dal;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.dt.common.sequence.persist.BaseSeqMapper;

/**
 * <p>creation time: 2019/01/21 18:29</p>
 *
 * @author yujiadong
 **/
public interface PolicyBaseSeqMapper extends BaseSeqMapper {
    @Override
    @Select("select 1 from t_agr_sequence where agr_biz_code=#{biz}")
    Integer checkBizItemExists(@Param("biz") String biz);

    @Override
    @Insert("INSERT INTO t_agr_sequence (agr_biz_code, max_id, `description`) VALUES (#{biz}, #{firstId}, #{desc})")
    int insert(@Param("biz") String biz, @Param("firstId") Integer firstId, @Param("desc") String desc);

    @Override
    @Select("select max_id from t_agr_sequence where agr_biz_code=#{biz}")
    long queryMaxId(@Param("biz") String biz);
}
